﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
using DQYT.HTDZ.BLL;
using DQYT.HTDZ.Model;

namespace DQYT.HTDZ.Web.BDVALUE
{
    public partial class Modify : Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
                {
                    decimal ID = (Convert.ToDecimal(Request.Params["id"]));
                    ShowInfo(ID);
                }
            }
        }

        private void ShowInfo(decimal ID)
        {
            BDVALUEBLL bll = new BDVALUEBLL();
            BDVALUEModel model = bll.GetModel(ID);
            this.lblID.Text = model.ID.ToString();
            this.txtWELLID.Text = model.WELLID;
            this.txtKSSJ.Text = model.KSSJ.ToString();
            this.txtJCRQ.Text = model.JCRQ.ToString();
            this.txtJSSJ.Text = model.JSSJ.ToString();
            this.txtDDJEDGL.Text = model.DDJEDGL.ToString();
            this.txtDDJEDZS.Text = model.DDJEDZS.ToString();
            this.txtCYJCC.Text = model.CYJCC.ToString();
            this.txtCYJCCI.Text = model.CYJCCI.ToString();
            this.txtSXDLMAX.Text = model.SXDLMAX.ToString();
            this.txtXXDLMAX.Text = model.XXDLMAX.ToString();
            this.txtDDZDZPHD.Text = model.DDZDZPHD.ToString();
            this.txtSXYGPJZ.Text = model.SXYGPJZ.ToString();
            this.txtXXYGPJZ.Text = model.XXYGPJZ.ToString();
            this.txtYGPJZPHD.Text = model.YGPJZPHD.ToString();
            this.txtSXYGMAX.Text = model.SXYGMAX.ToString();
            this.txtXXYGMAX.Text = model.XXYGMAX.ToString();
            this.txtYGZDZPHD.Text = model.YGZDZPHD.ToString();
            this.txtSXNJJFG.Text = model.SXNJJFG.ToString();
            this.txtXXNJJFG.Text = model.XXNJJFG.ToString();
            this.txtNJJFGPHD.Text = model.NJJFGPHD.ToString();
            this.txtRWGNH.Text = model.RWGNH.ToString();
            this.txtRYGZNH.Text = model.RYGZNH.ToString();
            this.txtRYGFNH.Text = model.RYGFNH.ToString();
            this.txtPJGLYS.Text = model.PJGLYS.ToString();
            this.txtPJYGGL.Text = model.PJYGGL.ToString();
            this.txtPJWGGL.Text = model.PJWGGL.ToString();
            this.txtPJSZGL.Text = model.PJSZGL.ToString();
            this.txtPJXDY.Text = model.PJXDY.ToString();
            this.txtPJXIDY.Text = model.PJXIDY.ToString();
            this.txtYGFZL.Text = model.YGFZL.ToString();
            this.txtYGPZL.Text = model.YGPZL.ToString();
            this.txtNJFZL.Text = model.NJFZL.ToString();
            this.txtNJPZL.Text = model.NJPZL.ToString();
            this.txtDMXL.Text = model.DMXL.ToString();
            this.txtXTXL.Text = model.XTXL.ToString();
            this.txtDYNH.Text = model.DYNH.ToString();
            this.txtRCYL.Text = model.RCYL.ToString();
            this.txtHS.Text = model.HS.ToString();
            this.txtDYM.Text = model.DYM.ToString();
            this.txtCMD.Text = model.CMD.ToString();
            this.txtBX.Text = model.BX.ToString();
            this.txtYY.Text = model.YY.ToString();
            this.txtTY.Text = model.TY.ToString();
            this.txtBS.Text = model.BS.ToString();
            this.txtLLPL.Text = model.LLPL.ToString();
            this.txtRCYOL.Text = model.RCYOL.ToString();
            this.txtPHKSL.Text = model.PHKSL.ToString();
            this.txtPHDWZ1.Text = model.PHDWZ1.ToString();
            this.txtPHDWZ2.Text = model.PHDWZ2.ToString();
            this.txtPHDWZ3.Text = model.PHDWZ3.ToString();
            this.txtPHDWZ4.Text = model.PHDWZ4.ToString();
            this.txtPHKZL1.Text = model.PHKZL1.ToString();
            this.txtPHKZL2.Text = model.PHKZL2.ToString();
            this.txtPHKZL3.Text = model.PHKZL3.ToString();
            this.txtPHKZL4.Text = model.PHKZL4.ToString();
            this.txtBJ.Text = model.BJ;

        }

        public void btnSave_Click(object sender, EventArgs e)
        {

            string strErr = "";
            if (this.txtWELLID.Text.Trim().Length == 0)
            {
                strErr += "WELLID不能为空！\\n";
            }
            if (!PageValidate.IsDateTime(txtKSSJ.Text))
            {
                strErr += "KSSJ格式错误！\\n";
            }
            if (!PageValidate.IsDateTime(txtJCRQ.Text))
            {
                strErr += "JCRQ格式错误！\\n";
            }
            if (!PageValidate.IsDateTime(txtJSSJ.Text))
            {
                strErr += "JSSJ格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtDDJEDGL.Text))
            {
                strErr += "DDJEDGL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtDDJEDZS.Text))
            {
                strErr += "DDJEDZS格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtCYJCC.Text))
            {
                strErr += "CYJCC格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtCYJCCI.Text))
            {
                strErr += "CYJCCI格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtSXDLMAX.Text))
            {
                strErr += "SXDLMAX格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtXXDLMAX.Text))
            {
                strErr += "XXDLMAX格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtDDZDZPHD.Text))
            {
                strErr += "DDZDZPHD格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtSXYGPJZ.Text))
            {
                strErr += "SXYGPJZ格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtXXYGPJZ.Text))
            {
                strErr += "XXYGPJZ格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtYGPJZPHD.Text))
            {
                strErr += "YGPJZPHD格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtSXYGMAX.Text))
            {
                strErr += "SXYGMAX格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtXXYGMAX.Text))
            {
                strErr += "XXYGMAX格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtYGZDZPHD.Text))
            {
                strErr += "YGZDZPHD格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtSXNJJFG.Text))
            {
                strErr += "SXNJJFG格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtXXNJJFG.Text))
            {
                strErr += "XXNJJFG格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtNJJFGPHD.Text))
            {
                strErr += "NJJFGPHD格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtRWGNH.Text))
            {
                strErr += "RWGNH格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtRYGZNH.Text))
            {
                strErr += "RYGZNH格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtRYGFNH.Text))
            {
                strErr += "RYGFNH格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPJGLYS.Text))
            {
                strErr += "PJGLYS格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPJYGGL.Text))
            {
                strErr += "PJYGGL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPJWGGL.Text))
            {
                strErr += "PJWGGL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPJSZGL.Text))
            {
                strErr += "PJSZGL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPJXDY.Text))
            {
                strErr += "PJXDY格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPJXIDY.Text))
            {
                strErr += "PJXIDY格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtYGFZL.Text))
            {
                strErr += "YGFZL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtYGPZL.Text))
            {
                strErr += "YGPZL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtNJFZL.Text))
            {
                strErr += "NJFZL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtNJPZL.Text))
            {
                strErr += "NJPZL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtDMXL.Text))
            {
                strErr += "DMXL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtXTXL.Text))
            {
                strErr += "XTXL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtDYNH.Text))
            {
                strErr += "DYNH格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtRCYL.Text))
            {
                strErr += "RCYL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtHS.Text))
            {
                strErr += "HS格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtDYM.Text))
            {
                strErr += "DYM格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtCMD.Text))
            {
                strErr += "CMD格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtBX.Text))
            {
                strErr += "BX格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtYY.Text))
            {
                strErr += "YY格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtTY.Text))
            {
                strErr += "TY格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtBS.Text))
            {
                strErr += "BS格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtLLPL.Text))
            {
                strErr += "LLPL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtRCYOL.Text))
            {
                strErr += "RCYOL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPHKSL.Text))
            {
                strErr += "PHKSL格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPHDWZ1.Text))
            {
                strErr += "PHDWZ1格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPHDWZ2.Text))
            {
                strErr += "PHDWZ2格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPHDWZ3.Text))
            {
                strErr += "PHDWZ3格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPHDWZ4.Text))
            {
                strErr += "PHDWZ4格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPHKZL1.Text))
            {
                strErr += "PHKZL1格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPHKZL2.Text))
            {
                strErr += "PHKZL2格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPHKZL3.Text))
            {
                strErr += "PHKZL3格式错误！\\n";
            }
            if (!PageValidate.IsDecimal(txtPHKZL4.Text))
            {
                strErr += "PHKZL4格式错误！\\n";
            }
            if (this.txtBJ.Text.Trim().Length == 0)
            {
                strErr += "BJ不能为空！\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            decimal ID = decimal.Parse(this.lblID.Text);
            string WELLID = this.txtWELLID.Text;
            DateTime KSSJ = DateTime.Parse(this.txtKSSJ.Text);
            DateTime JCRQ = DateTime.Parse(this.txtJCRQ.Text);
            DateTime JSSJ = DateTime.Parse(this.txtJSSJ.Text);
            decimal DDJEDGL = decimal.Parse(this.txtDDJEDGL.Text);
            decimal DDJEDZS = decimal.Parse(this.txtDDJEDZS.Text);
            decimal CYJCC = decimal.Parse(this.txtCYJCC.Text);
            decimal CYJCCI = decimal.Parse(this.txtCYJCCI.Text);
            decimal SXDLMAX = decimal.Parse(this.txtSXDLMAX.Text);
            decimal XXDLMAX = decimal.Parse(this.txtXXDLMAX.Text);
            decimal DDZDZPHD = decimal.Parse(this.txtDDZDZPHD.Text);
            decimal SXYGPJZ = decimal.Parse(this.txtSXYGPJZ.Text);
            decimal XXYGPJZ = decimal.Parse(this.txtXXYGPJZ.Text);
            decimal YGPJZPHD = decimal.Parse(this.txtYGPJZPHD.Text);
            decimal SXYGMAX = decimal.Parse(this.txtSXYGMAX.Text);
            decimal XXYGMAX = decimal.Parse(this.txtXXYGMAX.Text);
            decimal YGZDZPHD = decimal.Parse(this.txtYGZDZPHD.Text);
            decimal SXNJJFG = decimal.Parse(this.txtSXNJJFG.Text);
            decimal XXNJJFG = decimal.Parse(this.txtXXNJJFG.Text);
            decimal NJJFGPHD = decimal.Parse(this.txtNJJFGPHD.Text);
            decimal RWGNH = decimal.Parse(this.txtRWGNH.Text);
            decimal RYGZNH = decimal.Parse(this.txtRYGZNH.Text);
            decimal RYGFNH = decimal.Parse(this.txtRYGFNH.Text);
            decimal PJGLYS = decimal.Parse(this.txtPJGLYS.Text);
            decimal PJYGGL = decimal.Parse(this.txtPJYGGL.Text);
            decimal PJWGGL = decimal.Parse(this.txtPJWGGL.Text);
            decimal PJSZGL = decimal.Parse(this.txtPJSZGL.Text);
            decimal PJXDY = decimal.Parse(this.txtPJXDY.Text);
            decimal PJXIDY = decimal.Parse(this.txtPJXIDY.Text);
            decimal YGFZL = decimal.Parse(this.txtYGFZL.Text);
            decimal YGPZL = decimal.Parse(this.txtYGPZL.Text);
            decimal NJFZL = decimal.Parse(this.txtNJFZL.Text);
            decimal NJPZL = decimal.Parse(this.txtNJPZL.Text);
            decimal DMXL = decimal.Parse(this.txtDMXL.Text);
            decimal XTXL = decimal.Parse(this.txtXTXL.Text);
            decimal DYNH = decimal.Parse(this.txtDYNH.Text);
            decimal RCYL = decimal.Parse(this.txtRCYL.Text);
            decimal HS = decimal.Parse(this.txtHS.Text);
            decimal DYM = decimal.Parse(this.txtDYM.Text);
            decimal CMD = decimal.Parse(this.txtCMD.Text);
            decimal BX = decimal.Parse(this.txtBX.Text);
            decimal YY = decimal.Parse(this.txtYY.Text);
            decimal TY = decimal.Parse(this.txtTY.Text);
            decimal BS = decimal.Parse(this.txtBS.Text);
            decimal LLPL = decimal.Parse(this.txtLLPL.Text);
            decimal RCYOL = decimal.Parse(this.txtRCYOL.Text);
            decimal PHKSL = decimal.Parse(this.txtPHKSL.Text);
            decimal PHDWZ1 = decimal.Parse(this.txtPHDWZ1.Text);
            decimal PHDWZ2 = decimal.Parse(this.txtPHDWZ2.Text);
            decimal PHDWZ3 = decimal.Parse(this.txtPHDWZ3.Text);
            decimal PHDWZ4 = decimal.Parse(this.txtPHDWZ4.Text);
            decimal PHKZL1 = decimal.Parse(this.txtPHKZL1.Text);
            decimal PHKZL2 = decimal.Parse(this.txtPHKZL2.Text);
            decimal PHKZL3 = decimal.Parse(this.txtPHKZL3.Text);
            decimal PHKZL4 = decimal.Parse(this.txtPHKZL4.Text);
            string BJ = this.txtBJ.Text;


            BDVALUEModel model = new BDVALUEModel();
            model.ID = ID;
            model.WELLID = WELLID;
            model.KSSJ = KSSJ;
            model.JCRQ = JCRQ;
            model.JSSJ = JSSJ;
            model.DDJEDGL = DDJEDGL;
            model.DDJEDZS = DDJEDZS;
            model.CYJCC = CYJCC;
            model.CYJCCI = CYJCCI;
            model.SXDLMAX = SXDLMAX;
            model.XXDLMAX = XXDLMAX;
            model.DDZDZPHD = DDZDZPHD;
            model.SXYGPJZ = SXYGPJZ;
            model.XXYGPJZ = XXYGPJZ;
            model.YGPJZPHD = YGPJZPHD;
            model.SXYGMAX = SXYGMAX;
            model.XXYGMAX = XXYGMAX;
            model.YGZDZPHD = YGZDZPHD;
            model.SXNJJFG = SXNJJFG;
            model.XXNJJFG = XXNJJFG;
            model.NJJFGPHD = NJJFGPHD;
            model.RWGNH = RWGNH;
            model.RYGZNH = RYGZNH;
            model.RYGFNH = RYGFNH;
            model.PJGLYS = PJGLYS;
            model.PJYGGL = PJYGGL;
            model.PJWGGL = PJWGGL;
            model.PJSZGL = PJSZGL;
            model.PJXDY = PJXDY;
            model.PJXIDY = PJXIDY;
            model.YGFZL = YGFZL;
            model.YGPZL = YGPZL;
            model.NJFZL = NJFZL;
            model.NJPZL = NJPZL;
            model.DMXL = DMXL;
            model.XTXL = XTXL;
            model.DYNH = DYNH;
            model.RCYL = RCYL;
            model.HS = HS;
            model.DYM = DYM;
            model.CMD = CMD;
            model.BX = BX;
            model.YY = YY;
            model.TY = TY;
            model.BS = BS;
            model.LLPL = LLPL;
            model.RCYOL = RCYOL;
            model.PHKSL = PHKSL;
            model.PHDWZ1 = PHDWZ1;
            model.PHDWZ2 = PHDWZ2;
            model.PHDWZ3 = PHDWZ3;
            model.PHDWZ4 = PHDWZ4;
            model.PHKZL1 = PHKZL1;
            model.PHKZL2 = PHKZL2;
            model.PHKZL3 = PHKZL3;
            model.PHKZL4 = PHKZL4;
            model.BJ = BJ;

            BDVALUEBLL bll = new BDVALUEBLL();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功！", "list.aspx");

        }


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
